package com.cskaoyan.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author stone
 * @date 2022/12/22 15:45
 */
@Controller // day03注解 ioc → 这个注解的功能就是注册组件
public class HelloController {

    @RequestMapping("hello")//映射URL → localhost:8080/hello
    @ResponseBody
    public String hello(String username) {// 形参 → 通过形参接收了请求参数
        String result = "hello " + username;
        return result; //要响应的值直接返回
    }

    @RequestMapping("goodbye")
    @ResponseBody
    public String goodbye(String username) {
        return "goodbye " + username;
    }
}
